#!/bin/bash
set -e

function print_relation_data {
	for id in $(relation-ids $1); do
		for remote in $(relation-list -r $id); do
			rel_data=$(relation-get -r $id - $remote)
			juju-log "[$id to remote $remote] data:\n"`echo $rel_data | sed 's/^/  /g'`"\n"
		done
	done
}

juju-log "config CHANGED"
print_relation_data "defend-a"
print_relation_data "defend-b"
